#include <iostream>

using namespace std;

class Watch {
    private:
        float m_min;
        float m_sec;
    public:
        Watch(): m_min(0.0), m_sec(0.0) {}
        Watch run();

        Watch operator++(); // 前置++
        Watch operator++(int arg); // 后置++

        friend ostream &operator<<(ostream &out, const Watch &w);
};

Watch Watch::run()
{
    this->m_sec++;

    if (this->m_sec >= 60) {
        this->m_min++;
        this->m_sec = 0;
    }

    return *this; // this 的类型是 Watch *
}

Watch Watch::operator++()
{
    run();

    return *this;
}

Watch Watch::operator++(int arg)
{
    Watch w = *this;
    run();

    return w;
}

ostream &operator<<(ostream &out, const Watch &w)
{
    out << w.m_min << ":" << w.m_sec;
    return out;
}

int main(void)
{
    Watch w1, w2;

    cout << w1 << endl;	
    w2 = w1++;
    cout << w1 << endl;
    cout << w2 << endl;

    w2 = ++w1;
    cout << w1 << endl;
    cout << w2 << endl;

    return 0;
}

